import axios from 'axios'

export default function request(url, data={}, method='GET') {
  let payload 
  if (method === 'GET') {
    payload = { url, method, params: data }
  } else if (method === 'POST') {
    payload = { url, method, data }
  }
  return axios(payload)
}